home *** CD-ROM | disk | FTP | other *** search
- Path: maximus.East.DELFIN.COM!news
- From: Mike_Kapfer@notes.east.delfin.com
- Newsgroups: comp.lang.c
- Subject: Re: Mouse Routines using C/C++
- Date: 19 Jan 1996 14:38:53 GMT
- Organization: Delfin Systems
- Message-ID: <4doadt$149@maximus.East.DELFIN.COM>
- References: <Pine.ULT.3.91.960118140647.27317A-100000@wpi.WPI.EDU>
- Reply-To: Mike_Kapfer@notes.east.delfin.com
- NNTP-Posting-Host: maximus.East.DELFIN.COM
- X-Newsreader: IBM NewsReader/2 v1.2.5
-
- In <Pine.ULT.3.91.960118140647.27317A-100000@wpi.WPI.EDU>, Jon Day <jonday@wpi.edu> writes:
- >I have some simple routines to implement a mouse handler is assembler but
- >nothin in C or C++. Can anyone provide me with example code on how to set
- >up an interrupt handler for the mouse using only C?
- >
-
- This is probably off topic so expect a bunch of flames. :)
-
- Control of the mouse is very specific to the operating system/environment.
- In DOS, you handle the mouse through interrupts (int86 call). In Windows,
- there are C APIs to handle control of the mouse.
-
- Here is an example of how you would set up the registers and call int86 on a
- DOS machine ... the function is read_mouse and comes from "The C Programmers
- Toolkit" book by Jack Purdum (a pretty good entry level set of routines):
-
- void read_mouse ( int *row, int *col, int *button )
- {
- /* This function returns the mouse position in row and col */
- /* And the status of the buttons */
-
- union REGS ireg ;
-
- ireg.x.ax = 0x03 ; /* Load 0x03 in ax register for mouse pos and status */
- int86 ( 0x33, &ireg, &ireg ) ; /* Call interrupt */
- *button = ireg.x.bx ;
- *col = ireg.x.cx ;
- *row = ireg.x.dx ;
- }
- ===
- Michael Kapfer Phone: (703) 758-0190 x2150
-
- Internet: Mike_Kapfer@notes.east.delfin.com
- For PGP public key, finger mkapfer@east.delfin.com
-